﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using OrganizedIN.DAL;
using OrganizedIN.BAL;
using OrganizedIN.BussinessServices;
//using System.Windows.Forms;

namespace OrganizedIN.BAL.Common
{
    public sealed class Common
    {

        public static DataSet AjaxSearchDemo(string prefixSearch)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            //param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            //param[0].Value = strUserName;

            param[0] = new SqlParameter("@vcrPrefix", SqlDbType.VarChar, 100);
            param[0].Value = prefixSearch;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_QuickSearch", param);
            return ds;
        }

        public static DataSet Get_Todo_List(string UserName, string dtmDate)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@dtmTodoDate", SqlDbType.VarChar, 100);
            param[1].Value = dtmDate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_GetList", param);
            return ds;
        }

        public static string createRatingImages(int rating)
        {
            int empty_stars = 5 - rating;
            string outHtml = string.Empty;
            for (int i = 1; i <= rating; i++)
            {
                outHtml += "<img style='float:left;' alt='rating' src='../../images/rating_star.png' />";
            }
            if (empty_stars > 0)
            {
                for (int i = 1; i <= empty_stars; i++)
                {
                    outHtml += "<img style='float:left;' alt='rating' src='../../images/rating_star_grey.png' />";
                }
            }
            if (rating > 0)
            {
                outHtml += "<div style='clear:both;'></div>";
            }
            return outHtml;
        }

        public static DataSet Add_New_Todo(string UserName, string Todo_date, string Todo_Summary, string Todo_Desc)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[4];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@dtmTodoDate", SqlDbType.VarChar, 100);
            param[1].Value = Todo_date;

            param[2] = new SqlParameter("@vcrTodoSummary", SqlDbType.VarChar, 100);
            param[2].Value = Todo_Summary;

            param[3] = new SqlParameter("@vcrTodoDesc", SqlDbType.VarChar, 100);
            param[3].Value = Todo_Desc;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_AddNewTodos", param);
            return ds;
        }

        public static DataSet Get_Todo_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_GetList", param);
            return ds;
        }

        public static DataSet Todo_Priority_Change(string strTodoID, string strAction, string strUserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[3];

            param[0] = new SqlParameter("@vcrTodoID", SqlDbType.VarChar, 100);
            param[0].Value = strTodoID;

            param[1] = new SqlParameter("@vcrAction", SqlDbType.VarChar, 100);
            param[1].Value = strAction;

            param[2] = new SqlParameter("@UserID", SqlDbType.VarChar, 100);
            param[2].Value = strUserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_Priority_Change", param);
            return ds;
        }

        public static DataSet Get_Video_Album_Details(string UserName, string albumid)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrAlbumId", SqlDbType.VarChar, 10);
            param[1].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_GetAlbumDetails", param);
            return ds;
        }

        public static DataSet Get_Video_Album_Vids(string UserName, string albumid)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrAlbumId", SqlDbType.VarChar, 10);
            param[1].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_GetAlbumVids", param);
            return ds;
        }

        public static DataSet Get_Video_Album_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_GetAlbumList", param);
            return ds;
        }

        public static DataSet Get_Photo_Album_Details(string UserName, string albumid)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrAlbumId", SqlDbType.VarChar, 10);
            param[1].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_GetAlbumDetails", param);
            return ds;
        }

        public static DataSet Get_Photo_Album_Pics(string UserName, string albumid)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrAlbumId", SqlDbType.VarChar, 10);
            param[1].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_GetAlbumPics", param);
            return ds;
        }

        public static DataSet Get_Photo_Album_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_GetAlbumList", param);
            return ds;
        }


        public static DataSet Get_Video_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Path_GetList", param);
            return ds;
        }
        public static DataSet Get_Todo_SearchResult(string UserName, string strSubject, string dtmTodoDate, string strPriority, int intDay, string strSort)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrSubject", SqlDbType.VarChar, 100);
            param[1].Value = strSubject;

            param[2] = new SqlParameter("@vcrTodoDate", SqlDbType.VarChar, 100);
            param[2].Value = dtmTodoDate;

            param[3] = new SqlParameter("@vcrPriority", SqlDbType.VarChar, 100);
            param[3].Value = strPriority;

            param[4] = new SqlParameter("@intDay", SqlDbType.Int);
            param[4].Value = intDay;

            param[5] = new SqlParameter("@vcrSort", SqlDbType.VarChar, 100);
            param[5].Value = strSort;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_SearchResult", param);
            return ds;
        }

        public static DataSet Todo_ArchiveList(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_Archive", param);
            return ds;
        }

        public static DataSet Todo_Mark_Completed(string strTodoIds)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrTodoIDs", SqlDbType.VarChar, 100);
            param[0].Value = strTodoIds;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_MarkCompleted", param);
            return ds;
        }

        public static DataSet Todo_ReDate(string strTodoIds, string dtmRedate)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrTodoIDs", SqlDbType.VarChar, 100);
            param[0].Value = strTodoIds;

            param[1] = new SqlParameter("@dtmReDate", SqlDbType.VarChar, 100);
            param[1].Value = dtmRedate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_ReDate", param);
            return ds;
        }

        public static DataSet Add_New_Photo(string UserName, string Photo_Title, string PhotoPath, string Summary, string Rating, string Status, string EventName, string EventDate, string Date, string

SharerName, string albumid)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[11];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrPhotoTitle", SqlDbType.VarChar, 100);
            param[1].Value = Photo_Title;

            param[2] = new SqlParameter("@vcrPhotoPath", SqlDbType.VarChar, 100);
            param[2].Value = PhotoPath;

            param[3] = new SqlParameter("@vcrPhotoDetail", SqlDbType.VarChar, 4000);
            param[3].Value = Summary;

            param[4] = new SqlParameter("@vcrPhotoRating", SqlDbType.VarChar, 10);
            param[4].Value = Rating;

            param[5] = new SqlParameter("@vcrPhotoStatus", SqlDbType.VarChar, 100);
            param[5].Value = Status;

            param[6] = new SqlParameter("@vcrPhotoEvent", SqlDbType.VarChar, 100);
            param[6].Value = EventName;

            param[7] = new SqlParameter("@vcrPhotoEventDate", SqlDbType.VarChar, 100);
            param[7].Value = EventDate;

            param[8] = new SqlParameter("@vcrLastActivity", SqlDbType.VarChar, 100);
            param[8].Value = Date;

            param[9] = new SqlParameter("@vcrPhotoShare", SqlDbType.VarChar, 100);
            param[9].Value = SharerName;

            param[10] = new SqlParameter("@vcralbumid", SqlDbType.VarChar, 10);
            param[10].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_AddNewPhoto", param);
            return ds;
        }

        public static DataSet Get_Photos_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_GetList", param);
            return ds;
        }

        public static DataSet Photo_ArchiveList(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Archive", param);
            return ds;
        }

        public static DataSet Get_Photo_SearchResult(string UserName, string strSubject, string dtmCreatedDate, string strEventName, string strRating, string strSort)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrSubject", SqlDbType.VarChar, 100);
            param[1].Value = strSubject;

            param[2] = new SqlParameter("@vcrCreatedDate", SqlDbType.VarChar, 100);
            param[2].Value = dtmCreatedDate;

            param[3] = new SqlParameter("@vcrEventName", SqlDbType.VarChar, 100);
            param[3].Value = strEventName;

            param[4] = new SqlParameter("@vcrRating", SqlDbType.VarChar, 1);
            param[4].Value = strRating;

            param[5] = new SqlParameter("@vcrSort", SqlDbType.VarChar, 100);
            param[5].Value = "";

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_SearchResult", param);
            return ds;
        }

        public static DataSet Photo_ReDate(string strTodoIds, string dtmRedate)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrPhotoIDs", SqlDbType.VarChar, 100);
            param[0].Value = strTodoIds;

            param[1] = new SqlParameter("@dtmReDate", SqlDbType.VarChar, 100);
            param[1].Value = dtmRedate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_ReDate", param);
            return ds;
        }

        public static DataSet Photo_Update_Rating(string strPhotoIds, string strRating)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrPhotoIDs", SqlDbType.VarChar, 100);
            param[0].Value = strPhotoIds;

            param[1] = new SqlParameter("@vcrRating", SqlDbType.VarChar, 100);
            param[1].Value = strRating;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Update_Rating", param);
            return ds;
        }

        public static DataSet Photo_Delete(string strPhotoIds)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrPhotoIDs", SqlDbType.VarChar, 100);
            param[0].Value = strPhotoIds;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Delete", param);
            return ds;
        }


        public static DataSet Add_New_Videos(string UserName, string VideoSummary, string VideoRating, string VideoSharerName, string VideoUpload, string VideoEventName, string videotitle, string

album)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[8];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrVideoSummary", SqlDbType.VarChar, 100);
            param[1].Value = VideoSummary;

            param[2] = new SqlParameter("@vcrVideoRating", SqlDbType.VarChar, 1);
            param[2].Value = VideoRating;

            param[3] = new SqlParameter("@vcrVideoSharerName", SqlDbType.VarChar, 100);
            param[3].Value = VideoSharerName;

            param[4] = new SqlParameter("@vcrVideoUpload", SqlDbType.VarChar, 100);
            param[4].Value = VideoUpload;

            param[5] = new SqlParameter("@vcrVideoEventName", SqlDbType.VarChar, 100);
            param[5].Value = VideoEventName;

            param[6] = new SqlParameter("@vcrVideoTitle", SqlDbType.VarChar, 100);
            param[6].Value = videotitle;

            param[7] = new SqlParameter("@vcrVideoAlbum", SqlDbType.VarChar, 100);
            param[7].Value = album;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_AddNewVideos", param);
            return ds;
        }

        public static DataSet Get_Video_Rating_List(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Rating_GetList", param);
            return ds;
        }

        public static DataSet Get_Video_Rating_List(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param;
            if (id != null)
            {
                param = new SqlParameter[2];
                param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
                param[1].Value = id;
            }
            else
            {
                param = new SqlParameter[1];
            }

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Rating_GetList", param);
            return ds;
        }

        public static DataSet updateVideoRating(string UserName, int id, string rate)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrVideoRating", SqlDbType.VarChar, 1);
            param[2].Value = rate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Update_Rating", param);
            return ds;
        }

        public static DataSet getVideoName(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Name_GetList", param);
            return ds;
        }

        public static DataSet updateVideoName(string UserName, int id, string name)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrVideoName", SqlDbType.VarChar, 100);
            param[2].Value = name;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Update_Name", param);
            return ds;
        }

        public static DataSet getVideoDate(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Date_GetList", param);
            return ds;
        }

        public static DataSet updateVideoDate(string UserName, int id, string date)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrVideoDate", SqlDbType.VarChar, 15);
            param[2].Value = date;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Update_Date", param);
            return ds;
        }

        public static DataSet getVideoDetail(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();

            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Detail", param);
            return ds;
        }

        public static DataSet getVideoDetail(string UserName, int id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();

            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrid", SqlDbType.VarChar, 100);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Detail", param);
            return ds;
        }

        public static DataSet deleteVideo(string UserName, int id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Delete", param);
            return ds;
        }

        public static DataSet Get_Video_Search_List(string UserName, string title, string v_event, string share, string rate)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[5];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrtitle", SqlDbType.VarChar, 100);
            param[1].Value = title;

            param[2] = new SqlParameter("@vcrevent", SqlDbType.VarChar, 100);
            param[2].Value = v_event;

            param[3] = new SqlParameter("@vcrshare", SqlDbType.VarChar, 50);
            param[3].Value = share;

            param[4] = new SqlParameter("@vcrrating", SqlDbType.VarChar, 1);
            param[4].Value = rate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Search", param);
            return ds;
        }


        public static DataSet Get_Video_Search_List(string UserName, string title, string v_event, string share, string rate, string date)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrtitle", SqlDbType.VarChar, 100);
            param[1].Value = title;

            param[2] = new SqlParameter("@vcrevent", SqlDbType.VarChar, 100);
            param[2].Value = v_event;

            param[3] = new SqlParameter("@vcrshare", SqlDbType.VarChar, 50);
            param[3].Value = share;

            param[4] = new SqlParameter("@vcrrating", SqlDbType.VarChar, 1);
            param[4].Value = rate;

            param[5] = new SqlParameter("@vcrdatetime", SqlDbType.VarChar, 15);
            param[5].Value = date;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Videos_Search", param);
            return ds;
        }

        public static DataSet getVideoSortResult(string UserName, string title, string v_event, string share, string rate, string date, string sortparam)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[7];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrtitle", SqlDbType.VarChar, 100);
            param[1].Value = title;

            param[2] = new SqlParameter("@vcrevent", SqlDbType.VarChar, 100);
            param[2].Value = v_event;

            param[3] = new SqlParameter("@vcrshare", SqlDbType.VarChar, 50);
            param[3].Value = share;

            param[4] = new SqlParameter("@vcrrating", SqlDbType.VarChar, 1);
            param[4].Value = rate;

            param[5] = new SqlParameter("@vcrdatetime", SqlDbType.VarChar, 15);
            param[5].Value = date;

            param[6] = new SqlParameter("@vcrsortparam", SqlDbType.VarChar, 50);
            param[6].Value = sortparam;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Sort_Search_Result", param);
            return ds;
        }

        public static DataSet getPhotoSortResult(string UserName, string title, string v_event, string share, string rate, string date, string sortparam)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[7];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrtitle", SqlDbType.VarChar, 100);
            param[1].Value = title;

            param[2] = new SqlParameter("@vcrevent", SqlDbType.VarChar, 100);
            param[2].Value = v_event;

            param[3] = new SqlParameter("@vcrshare", SqlDbType.VarChar, 50);
            param[3].Value = share;

            param[4] = new SqlParameter("@vcrrating", SqlDbType.VarChar, 1);
            param[4].Value = rate;

            param[5] = new SqlParameter("@vcrdatetime", SqlDbType.VarChar, 15);
            param[5].Value = date;

            param[6] = new SqlParameter("@vcrsortparam", SqlDbType.VarChar, 50);
            param[6].Value = sortparam;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Sort_Search_Result", param);
            return ds;
        }

        public static DataSet getPhotoSearchList(string UserName, string title, string v_event, string share, string rate, string date)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[6];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrtitle", SqlDbType.VarChar, 100);
            param[1].Value = title;

            param[2] = new SqlParameter("@vcrevent", SqlDbType.VarChar, 100);
            param[2].Value = v_event;

            param[3] = new SqlParameter("@vcrshare", SqlDbType.VarChar, 50);
            param[3].Value = share;

            param[4] = new SqlParameter("@vcrrating", SqlDbType.VarChar, 1);
            param[4].Value = rate;

            param[5] = new SqlParameter("@vcrdatetime", SqlDbType.VarChar, 15);
            param[5].Value = date;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Search", param);
            return ds;
        }

        public static DataSet getPhotoRate(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Rating_GetList", param);
            return ds;
        }

        public static DataSet updatePhotoRating(string UserName, int id, string rate)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrRating", SqlDbType.VarChar, 1);
            param[2].Value = rate;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Update_Rating", param);
            return ds;
        }

        public static DataSet updatePhotoAlbum(string UserName, int id, string albumid)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcralbumid", SqlDbType.VarChar, 10);
            param[2].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Update_Album", param);
            return ds;
        }

        public static DataSet getPhotoName(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Name_GetList", param);
            return ds;
        }

        public static DataSet updatePhotoName(string UserName, int id, string name)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrName", SqlDbType.VarChar, 100);
            param[2].Value = name;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Update_Name", param);
            return ds;
        }

        public static DataSet getPhotoDate(string UserName, string id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Char, 10);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Date_GetList", param);
            return ds;
        }

        public static DataSet updatePhotoDate(string UserName, int id, string date)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcrDate", SqlDbType.VarChar, 15);
            param[2].Value = date;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_ReDate", param);
            return ds;
        }

        public static DataSet getPhotoDetail(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Detail", param);
            return ds;
        }

        public static DataSet getPhotoDetail(string UserName, int id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrid", SqlDbType.VarChar, 100);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Detail", param);
            return ds;
        }

        public static DataSet deletePhoto(string UserName, int id)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photos_Delete", param);
            return ds;
        }

        public static DataSet getPhotoAlbum(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Get_Album", param);
            return ds;
        }

        public static DataSet getPhotoAlbum(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 100);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Get_Album", param);
            return ds;
        }

        public static DataSet getPhotoAlbumName(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 100);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Get_Album_Name", param);
            return ds;
        }

        public static DataSet addPhotoAlbum(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 100);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Photo_Add_Album", param);
            return ds;
        }

        public static DataSet getVideoAlbum(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Get_Album", param);
            return ds;
        }

        public static DataSet getVideoAlbum(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 10);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Get_Album", param);
            return ds;
        }

        public static DataSet getVideoAlbumName(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 100);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Get_Album_Name", param);
            return ds;
        }

        public static DataSet addVideoAlbum(string UserName, string title)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[2];

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@title", SqlDbType.VarChar, 100);
            param[1].Value = title;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Add_Album", param);
            return ds;
        }

        public static DataSet updateVideoAlbum(string UserName, int id, string albumid)
        {
            SqlService objservices = new SqlService();
            SqlParameter[] param = new SqlParameter[3];
            DataSet ds = new DataSet();

            param[0] = new SqlParameter("@vcrUser_MappingName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            param[1] = new SqlParameter("@vcrId", SqlDbType.Int);
            param[1].Value = id;

            param[2] = new SqlParameter("@vcralbumid", SqlDbType.VarChar, 10);
            param[2].Value = albumid;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_Video_Update_Album", param);
            return ds;
        }

        public static DataSet Get_ActivationKey()
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@Length", SqlDbType.Int, 10);
            param[0].Value = 10;
            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "sp_GeneratePassword", param);
            return ds;
        }
        public static DataSet Get_Todo_SearchResult(string UserName)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrUserName", SqlDbType.VarChar, 100);
            param[0].Value = UserName;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_PriorityResult", param);
            return ds;
        }
        public static DataSet Todo_AjaxUpdates(string strTodoID, string strAction, string strData)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[3];

            param[0] = new SqlParameter("@vcrID", SqlDbType.VarChar, 100);
            param[0].Value = strTodoID;

            param[1] = new SqlParameter("@vcrAction", SqlDbType.VarChar, 100);
            param[1].Value = strAction;

            param[2] = new SqlParameter("@vcrData", SqlDbType.VarChar, 100);
            param[2].Value = strData;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_AjaxUpdates", param);
            return ds;
        }
        public static DataSet ToDo_GetDetail(string UserName, string strTodoID)
        {
            SqlService objservices = new SqlService();
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];

            param[0] = new SqlParameter("@vcrTodoID", SqlDbType.VarChar, 100);
            param[0].Value = strTodoID;

            ds = SqlHelper.ExecuteDataset(objservices.ConnectionString, CommandType.StoredProcedure, "usp_ToDos_GetDetails", param);
            return ds;
        }
    }
}
